package com.stylefeng.guns.modular.system.warpper;

import com.stylefeng.guns.common.constant.factory.ConstantFactory;
import com.stylefeng.guns.common.constant.state.IsMenu;
import com.stylefeng.guns.common.warpper.BaseControllerWarpper;
import com.stylefeng.guns.modular.util.StringUtil;

import java.util.List;
import java.util.Map;

import org.springframework.util.LinkedCaseInsensitiveMap;

/**
 * 菜单列表的包装类
 *
 * @author fengshuonan
 * @date 2017年2月19日15:07:29
 */
public class MenuWarpper extends BaseControllerWarpper {

	public MenuWarpper(List<Map<String, Object>> list) {
		super(list);
	}

	@Override
	public void warpTheMap(Map<String, Object> map) {
		Map<String, Object> tempMap = new LinkedCaseInsensitiveMap<Object>();
		tempMap.putAll(map);
		map.putAll(tempMap);
		map.put("STATUSNAME", ConstantFactory.me()
				.getMenuStatusName(Integer.parseInt(StringUtil.nullToDefault(map.get("STATUS"), "0"))));

		map.put("ISMENUNAME", IsMenu.valueOf(Integer.parseInt(StringUtil.nullToDefault(map.get("ISMENU"), "0"))));
	}

}
